package com.andaily.domain.cooking;

import com.andaily.domain.cooking.settlement.CookingSettlement;
import com.andaily.domain.cooking.settlement.SettlementCookingAccount;
import com.andaily.domain.cooking.settlement.UserSettlement;
import com.andaily.domain.dto.cooking.CookingAccountOverviewDto;
import com.andaily.domain.dto.cooking.CookingSettlementHistoryDto;
import com.andaily.domain.shared.Repository;
import com.andaily.domain.user.User;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author Shengzhao Li
 */
public interface CookingAccountRepository extends Repository {

    void saveCookingAccount(CookingAccount account);

    CookingAccount findByGuid(String guid);

    void updateCookingAccount(CookingAccount account);

    List<CookingAccount> findCookingAccounts(CookingAccountOverviewDto overviewDto);

    int totalCookingAccounts(CookingAccountOverviewDto overviewDto);

    BigDecimal amountOfCookingAccountByStatus(CookingAccountStatus status);

    List<CookingAccount> findCookingAccountsByStatus(CookingAccountStatus status);

    void saveSettlement(CookingSettlement settlement);

    BigDecimal totalAmountOfCookingAccounts(@Param("accountGuids") String[] accountGuids);

    List<User> findAccountUsers(@Param("accountGuids") String[] accountGuids);

    BigDecimal amountOfCookingAccountByUser(@Param("userGuid") String userGuid, @Param("accountGuids") String[] accountGuids);

    List<CookingAccount> findCookingAccountsByGuids(@Param("accountGuids") String[] accountGuids);

    void updateCookingAccountsStatus(@Param("accountGuids") String[] accountGuids, @Param("status") CookingAccountStatus status);

    CookingSettlement findSettlementByGuid(String guid);

    void saveUserSettlements(@Param("settlement") CookingSettlement settlement, @Param("userSettlements") List<UserSettlement> userSettlements);

    void saveSettlementCookingAccounts(@Param("settlement") CookingSettlement settlement, @Param("accounts") List<SettlementCookingAccount> accounts);

    void archiveCookingAccount(String guid);

    List<String> findAllRecordedCookingAccounts();

    int totalCookingSettlements(CookingSettlementHistoryDto overviewDto);

    List<CookingSettlement> findCookingSettlements(CookingSettlementHistoryDto overviewDto);

    BigDecimal totalAmountOfSettlements();

    int totalSettlementAccountSize();
}
